import Vue from "vue";
import VueRouter from "vue-router";
// 引入布局组件
import Layout from '@/views/layout/index.vue'
Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    redirect: "login",
    hidden: true,
    meta: {
      name: "主页"
    }
  },
  {
    path: "/login",
    name: "login",
    hidden: true,
    meta: {
      name: "登录",
      noLogin:true,
    },
    component: () => import("../views/login/login.vue")
  },
  {
    path: "/layout",
    name: "layout",
    redirect:"index",
    meta: {
      name: "控制台",
      icon:'icon-console'
    },
    component: Layout,
    children: [
      {
        path: "/index",
        name: "index",
        meta: {
          name: "首页",
          isMenu:true,
        },
        component: () => import("../views/special/appIndex.vue"),
      }
    ]
  },
  // 信息管理
  {
    path: "/info",
    name: "info",
    meta: {
      name: "信息管理",
      icon:'icon-info',
      userCode:'info'
    },
    component: Layout,
    children: [
      {
        path: "/infoIndex",
        name: "infoIndex",
        meta: {
          name: "信息列表",
          isMenu:true,    //是否要在tab页签上展示
          keepAlive:true, //是否要缓存组件
        },
        component: () => import("../views/info/infoIndex.vue")
      },
      {
        path: "/info/infoItem",
        name: "infoItem",
        meta: {
          name: "信息分类",
          isMenu:true,
        },
        component: () => import("../views/info/infoItem.vue")
      }
    ]
  },
  // 用户管理
  {
    path: "/user",
    name: "user",
    meta: {
      name: "用户管理",
      icon:'icon-user',
      keepAlive:true,
      userCode:'user'
    },
    component: Layout,
    children: [
      {
        path: "/user/userIndex",
        name: "userIndex",
        meta: {
          name: "用户列表",
          isMenu:true,
        },
        component: () => import("../views/user/userIndex.vue")
      }
    ]
  }
];
const limitRoute = []
const router = new VueRouter({
  routes
});

export {router,limitRoute,routes};
